#include<iostream>
using namespace std;

class Box
{
//private 私有成员(默认)，只有类自己或者友元函数可以访问私有成员，对象不能访问
private:
    double length;
    double width;
    double height;
//protected 保护成员，自己和子类可访问，对象不能访问
//public 公有成员，都能访问
public:
    void setLength(double len);//函数声明
    void setWidth(double w);
    void setHeight(double h);
    double getVolume(void){//函数声明+定义
        return length * width * height;
    }
    

public:
    Box();//声明构造函数
    ~Box();
};

//函数外部定义
void Box::setLength(double len){
    length = len;
}

void Box::setWidth(double ww){
    width = ww;
}

void Box::setHeight(double h){
    height = h;
}

Box::Box()
{
    cout << "object is being created!" << endl;
}

Box::~Box()
{
    cout << "object is being distructed"<< endl;
}


int main(){
    double length = 10, width = 10, height = 10, volume = 0;
    Box myBox;
    myBox.setLength(length);
    myBox.setWidth(width);
    myBox.setHeight(height);
    volume = myBox.getVolume();
    std::cout << volume << std::endl;
}